package com.mt.roll.gateway.config;

import com.mt.roll.core.config.CommonConfig;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@RequiredArgsConstructor
@Configuration
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {

    private final CommonConfig mCommonConfig;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/common/**").addResourceLocations("file:" + mCommonConfig.getUploadPath());
        super.addResourceHandlers(registry);
    }
}
